#include <iostream>
#include <string>

using namespace std;

void pr_3_5_1()
{
    char cont = 'y';
    string s, result;
    cout << "请输入第一个字符串：" << endl;
    while (cin >> s)
    {
        result += s;
        cout << "是否继续（y or n)?" << endl;
        cin >> cont;
        if (cont == 'y' || cont == 'Y')
        {
            cout << "请输入下一个字符串:" << endl;
        }
        else
        {
            break;
        }
    }
    cout << "拼接后的字符串是：" << result << endl;
}

void pr_3_5_2()
{
    char cont = 'y';
    string s, result;
    cout << "请输入第一字符串：" << endl;
    while (cin >> s)
    {
        if (!result.size()) // 第一个拼接的字符串之前不加空格
        {
            result += s;
        }
        else // 之后每个拼接的字符串之前加一个空格
        {
            result = result + " " + s;
            cout << "是否继续（y or n)?" << endl;
            cin >> cont;
            if (cont == 'y' || cont == 'Y')
            {
                cout << "请输入下一个字符串:" << endl;
            }
            else
            {
                break;
            }
        }
    }
    cout << "拼接后的字符串是：" << result << endl;
}

void pr_3_6()
{
    string s("Lian ");
    for (auto &c : s)
    {
        c = 'X';
    }
    cout << s << endl;
}

void pr_3_10()
{
    string s;
    cout << "输入带标点符号的字符串" << endl;
    cin >> s;
    for (auto &c : s)
    {
        if (!ispunct(c)) // 如果字符是标签符号
        {
            cout << c;
        }
    }
}

int main()
{
    pr_3_10();
    return 0;
}
